package com.student.client.controller;

import com.student.client.entity.StudentHealthy;
import com.student.client.service.HealthyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RestController
@CrossOrigin
public class HealthyController {
    //查询所有身体信息记录接口
    @Autowired
    HealthyService healthyService;

    @RequestMapping("/studentHealthy")
    public List<StudentHealthy> getHealthy() {
        return healthyService.findAllHealthy();
    }
    //添加身体信息记录接口
    @PostMapping("/addHealthy")
    public Integer getHealthy(@RequestParam Float height,
                                 @RequestParam Float weight,
                                 @RequestParam String date) {
        StudentHealthy studentHealthy = new StudentHealthy(height, weight, date);
        return healthyService.addStudentHealthy(studentHealthy);
    }
}
